package main

import "fmt"

/*
   Author: mahaiyuan
   Date: 2021/3/31 1:55 下午
   Description:
*/
func main() {
	userIds := make([]string, 100)
	for i := 0; i < 100; i++ {
		userIds[i] = fmt.Sprintf("%d", i + 1)
	}
	fmt.Println("len(userIds) =", len(userIds))
	fmt.Println("userIds =", userIds)
	groupSize := 8
	groupNum := len(userIds) / groupSize + 1
	splitUserIds := make([][]string, groupNum)
	start := 0
	for i := 0; i < groupNum; i++ {
		end := start + groupSize
		if end > len(userIds) {
			end = len(userIds)
		}
		fmt.Printf("i = %d, slice = %v\n", i, userIds[start : end])
		splitUserIds[i] = userIds[start : end]
		start = end
	}
	fmt.Println("splitUserIds =", splitUserIds)
}